package cn.yunyichina.scheduler.jobs.job.order;

import cn.yunyichina.scheduler.jobs.service.order.CancleOrderService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.type.simple.api.SimpleJob;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by zhuxp on 2017/10/25.
 *
 * @param
 * @Descrition
 */
@Component
public class CancleOrderJob implements SimpleJob {

    private static final AtomicInteger count = new AtomicInteger(0);

    private Logger logger = LoggerFactory.getLogger(CancleOrderJob.class);
    @Resource
    private CancleOrderService cancleOrderService;

    @Override
    public void execute(ShardingContext shardingContext) {
        int current = count.addAndGet(1);
        logger.info("第[{}]次超时面诊未支付订单取消任务开始执行", current);
        cancleOrderService.doExecute();
        logger.info("第[{}]次超时面诊未支付订单取消任务执行结束", current);
    }
}
